Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 11436 - Cubes EXTREME! / j.cpp
blob59dfe0bd542bf4bb942bbde035c12c5ae7450268
1 #include<iostream>
2 #include<math.h>
3 using namespace std;
5 typedef unsigned long long ull;
7 ull cubo(ull x){
8 ull i=1;
9 while(i*i*i <= x){
10 ++i;
12 --i;
13 // cout << i << endl;
14 if (i*i*i == x){
15 return i;
16 }else{
17 return INT_MAX;
21 int main(){
22 ull n;
23 while(cin>>n &&n){
24 ull y = 1;
25 bool encontre=false;
26 while (true){
27 ull r = cubo(n + (y*y*y));
28 // cout << "r es: " << r << " y es: " << y << endl;
29 if (r != INT_MAX){
30 cout << r << " " << y << endl;
31 encontre = true;
32 break;
34 ++y;
35 if ((y+1)*(y+1)*(y+1) - y*y*y > n) break;
37 if (!encontre){
38 cout << "No solution\n";
39 continue;